Make GTK_DEBUG=interactive work better
authorMatthias Clasen <mclasen@redhat.com>
Wed, 4 Jan 2017 19:42:33 +0000 (14:42 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 8 Jan 2017 00:16:15 +0000 (19:16 -0500)
We currently have various ways to initialize GTK+, and not
all of them were supporting this way of bringing up the
inspector. Fix this.

https://bugzilla.gnome.org/show_bug.cgi?id=776807

gtk/gtkmain.c

index ab233dcf694671302f859c1e7f212c2e1d7a9fcc..c9b91b2aedfbe635fafbdfd250990d5ab337201f 100644 (file)
@@ -785,6 +785,9 @@ post_parse_hook (GOptionContext *context,
 
           return FALSE;
         }
+
+      if (gtk_get_debug_flags () & GTK_DEBUG_INTERACTIVE)
+        gtk_window_set_interactive_debugging (TRUE);
     }
 
   return TRUE;
@@ -964,7 +967,15 @@ gtk_init_with_args (gint                 *argc,
     return FALSE;
 
 done:
-  return gdk_display_open_default () != NULL;
+  if (gdk_display_open_default () != NULL)
+    {
+      if (gtk_get_debug_flags () & GTK_DEBUG_INTERACTIVE)
+        gtk_window_set_interactive_debugging (TRUE);
+
+      return TRUE;
+    }
+
+  return FALSE;
 }